<?php

header('Content-Type: text/html;charset=UTF-8');
$relatelist = '';
$sitemap = '';
$entryid = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0;
$clss = '';
if ($entryid > 1) {
    $entryrow = Db::getOneRow('*', 'article', 'id=' . $entryid);
    $rows = Db::getRows('*', 'article', 'type=' . $entryrow['type'] . ' and id !=' . $entryid . ' order by id Desc limit 0, 4');
    $type = $entryrow['type'];
    $menu = Db::getOneField('menu', 'type', 'id=' . $type);
    if ($menu == '1') {
        $clss = 'clyel';
        $_SESSION['class'] = 'clyel';
    } else if ($menu == '2') {
        $clss = 'clred';
        $_SESSION['class'] = 'clred';
    }else if ($menu == '3') {
        $clss = 'clpink';
        $_SESSION['class'] = 'clpink';
    } else if ($menu == '4' && $type != '7') {
        $clss = 'clblue';
        $_SESSION['class'] = 'clblue';
    } else {
        $clss = 'clgreen';
        $_SESSION['class'] = 'clgreen';
    }
    $nation = $entryrow['nation'];
    $level = $entryrow['level'];
    if (intval($nation) > 0) {
        $rows = Db::getRows('*', 'article', 'type=' . $entryrow['type'] . ' and nation=' . $nation . ' and id !=' . $entryid . ' order by id Desc limit 0, 4');

        if (intval($level) > 0) {
            $rows = Db::getRows('*', 'article', 'level=' . $level . ' and nation=' . $nation . ' and id !=' . $entryid . ' order by id Desc limit 0, 4');
        }
    }
    foreach ($rows as $row) {
        if (Lang::getCode() == 'en') {
            $relatelist.= '<li><a href="entrycontent?id=' . $row['id'] . '">' . $row['title2'] . '</a></li>';
        } else {
            $relatelist.= '<li><a href="entrycontent?id=' . $row['id'] . '">' . $row['title'] . '</a></li>';
        }
    }
    if (Lang::getCode() == 'en') {
        $sitemap = '<a href="entry?cid=' . $entryrow['type'] . '">' . Db::getOneField('name2', 'type', 'id=' . $entryrow['type']) . '</a> > <a href="#">' . $entryrow['title2'] . '</a>';
    } else {
        $sitemap = '<a href="entry?cid=' . $entryrow['type'] . '">' . Db::getOneField('name', 'type', 'id=' . $entryrow['type']) . '</a> > <a href="#">' . $entryrow['title'] . '</a>';
    }
} else {
    Js::gourl('home');
}
?>
